package com.study.leetcode;

public class Solution_278 {
    private boolean isBadVersion(int n) {
        return n >= 1702766719;
    }

    public int firstBadVersion(int n) {
        int lo = 1;
        int hi = n;

        while (lo < hi) {
            int mid = lo + (hi - lo) / 2;
            if (isBadVersion(mid)) {
                hi = mid;
            } else {
                lo = mid + 1;
            }
        }
        return hi;
    }

    public static void main(String[] args) {
        Solution_278 solution278 = new Solution_278();
        int i = solution278.firstBadVersion(2126753390);
        System.out.println("i = " + i);

    }
}
